import React, { Component } from 'react';
import { Link, Route, Switch } from 'react-router-dom';

import Home from './Home';
import Category from './Category'
import Car from './Car'
import Mine from './Mine';

// 引入自定义导航组价 Mynav.jsx 组件
import Mynav from '../components/Mynav';
class Father extends Component {
    state = {
        id: 100,
        id1: 99
    }
    render() {
        return (
            <>
                {/* 声明式导航 */}
                <div>
                    <Mynav to='/home' tag='p'>首页</Mynav>
                    <Mynav to='/category' >分类</Mynav>
                    <Mynav to='/car'>购物车</Mynav>
                    <Mynav to='/mine'>我的</Mynav>
                </div>
                {/* 路由规则 */}
                <Switch>
                    <Route path='/home' component={Home}></Route>
                    <Route path='/category' component={Category}></Route>
                    <Route path='/car' component={Car}></Route>
                    <Route path='/mine' component={Mine}></Route>
                </Switch>
            </>
        )
    }
}

export default Father